package com.bzm.controller.base;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.bzm.common.entity.HttpCode;
import com.bzm.common.entity.JsonResult;
import com.bzm.common.global.GlobalConfig;
import com.bzm.pojo.common.vo.ProjectInfoVo;

/**
 * @Description:基础公用的
 * @author hemiao
 * @time:2019年4月20日 下午7:43:10
 */
public class BaseController {
	
	@GetMapping(value = "/base")
	@ResponseBody
    public JsonResult<ProjectInfoVo> getBase(HttpServletRequest request){
    	ProjectInfoVo info = initProjectInfo();
		return new JsonResult<ProjectInfoVo>(info, HttpCode.SUCCESS);
    }
	
	public static final String LOGIN_USER_INFO = "LoginUserInfo";
	
	public static final String LOGIN_PHONE= "login_phone";
	
	public static final String TOKEN_NAME= "Auth-Token";
	
	public static final String PET = "/pet";
	
	public static final String UNION = "/union";
	
	public static final String TRADE = "/trade";
	
	public static final String BZM_TEST = "/bzm/test";
	
	public static final String BZM_INDEX = "/bzm/index";
	
	public static final String BZM_PLUGIN = "/bzm/plugin";
	
	
	/**
	 * @Description:获得版本号
	 * @param mv
	 * void
	 * @exception:
	 * @author: hemiao
	 * @time:2020年7月10日 上午9:12:54
	 */
	public static void getSaasVersion(ModelAndView mv) {
		mv.addObject("saas_version", "1.0.0");
	}
	
	/**
	 * 获得项目名称
	 * @author  hemiao
	 * @date   2021/1/4 17:21
	 * @param mv
	 * @Return
	 * @Exception
	 */
	public void getProjectInfo(ModelAndView mv) {
		ProjectInfoVo projectInfoVo = initProjectInfo();
		mv.addObject("project", projectInfoVo);
	}
	
	/**
	 * @Description:项目信息
	 * @return
	 * ProjectInfoVo
	 * @exception:
	 * @author: hemiao
	 * @time:2021年1月28日 下午3:00:48
	 */
	public ProjectInfoVo initProjectInfo() {
		ProjectInfoVo project = new ProjectInfoVo();
		project.setName("八爪猫");
		project.setVersion("1.0.0");
		project.setQq("68001531");
		project.setWechat("bzm9527168");
		project.setCompanyName("八爪猫-公司");
		project.setCompanyAddress("湖北武汉江夏区");
		project.setEmail("hm68001531@163.com");
		project.setHref("http://gitee.com/yyzhm");
		project.setFileService(GlobalConfig.FILE_SERVICE_LOCATION);
		project.setLogoUrl(GlobalConfig.FILE_SERVICE_LOCATION+GlobalConfig.LOGO_URL);
		return project;
	}
}
